// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   LoggerAction.java

package cn.com.pusai.base.logger.action;

import cn.com.pusai.base.logger.model.SysLog;
import cn.com.pusai.common.action.BaseAction;
import cn.com.pusai.common.config.SysProperties;
import cn.com.pusai.common.util.SearchMap;
import cn.com.pusai.core.util.DateUtil;
import cn.com.pusai.core.util.StringUtil;
import cn.com.pusai.base.logger.service.LoggerService;

import java.util.Map;

public class LoggerAction extends BaseAction
{
	
	private static final long serialVersionUID = 1L;
	private SysLog log;
	private String id;

	public LoggerAction()
	{
	}

	public String listSysLog()
		throws Exception
	{
		try
		{
			SearchMap searchMap = new SearchMap();
			String personAccount = StringUtil.trimToEmpty((String)getSearchValue().get("personAccount"));
			String moduleCode = (String)getSearchValue().get("moduleCode");
			String operateType = (String)getSearchValue().get("operateType");
			String result = (String)getSearchValue().get("result");
			String beginTime = (String)getSearchValue().get("searchStartTime");
			String endTime = (String)getSearchValue().get("searchEndTime");
			if (StringUtil.isNotBlank(personAccount))
				searchMap.eq("personAccount", personAccount);
			if (StringUtil.isNotBlank(moduleCode) && !"0".equals(moduleCode))
				searchMap.eq("moduleCode", StringUtil.trimToEmpty((String)getSearchValue().get("moduleCode")));
			if (StringUtil.isNotBlank(operateType))
				searchMap.eq("operateType", getSearchValue().get("operateType"));
			if (StringUtil.isNotBlank(result))
				searchMap.eq("result", getSearchValue().get("result"));
			if (StringUtil.isNotBlank(beginTime))
				searchMap.ge("operateTime", DateUtil.parse(beginTime, "yyyy-MM-dd HH:mm"));
			if (StringUtil.isNotBlank(endTime))
				searchMap.le("operateTime", DateUtil.parse(endTime, "yyyy-MM-dd HH:mm"));
			searchMap.addOrder("operateTime", "DESC");
			cn.com.pusai.core.page.PageResult pageResult = loggerService.findObjectsForPage(getPageNo(), SysProperties.PAGESIZE, searchMap);
			setPageResult(pageResult);
		}
		catch (Exception e)
		{
			handleException(e);
		}
		return "list";
	}

	public SysLog getLog()
	{
		return log;
	}

	public void setLogger(SysLog log)
	{
		this.log = log;
	}

	public String getId()
	{
		return id;
	}

	public void setId(String id)
	{
		this.id = id;
	}
}
